package com.zhao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSONObject;
import com.zhao.model.GetSetData;
import com.zhao.model.Lnglat;
import com.zhao.service.CalendarService;

/**
 * Created by zhaoronglei on 2018/9/18.
 */
@Controller
@RequestMapping(value = "/calendar")
public class CalendarController {
	
	@Value("${hosturl}")
 	private String hostUrl;
	
	@Autowired
	private CalendarService calendarService;

	@RequestMapping(value = "/latlng",method = RequestMethod.POST)
	public ModelAndView tosunRaise(Lnglat lnglat) {
		System.out.println("----"+JSONObject.toJSONString(lnglat));
		System.out.println("----"+ hostUrl );
		GetSetData data = calendarService.getData(lnglat);
		ModelAndView mv = new ModelAndView();
		mv.addObject("lnglat", data);
		mv.setViewName("default");
		return mv;
	}

}
